<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <title>Coverage for skf/api/sprints/business.py: 57%</title>
    <link rel="icon" sizes="32x32" href="favicon_32.png">
    <link rel="stylesheet" href="style.css" type="text/css">
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.hotkeys.js"></script>
    <script type="text/javascript" src="jquery.isonscreen.js"></script>
    <script type="text/javascript" src="coverage_html.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(coverage.pyfile_ready);
    </script>
</head>
<body class="pyfile">
<div id="header">
    <div class="content">
        <h1>Coverage for <b>skf/api/sprints/business.py</b> :
            <span class="pc_cov">57%</span>
        </h1>
        <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
        <h2 class="stats">
            126 statements &nbsp;
            <button type="button" class="run shortkey_r button_toggle_run" title="Toggle lines run">72 run</button>
            <button type="button" class="mis show_mis shortkey_m button_toggle_mis" title="Toggle lines missing">54 missing</button>
            <button type="button" class="exc show_exc shortkey_x button_toggle_exc" title="Toggle lines excluded">0 excluded</button>
        </h2>
    </div>
</div>
<div class="help_panel">
    <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" />
    <p class="legend">Hot-keys on this page</p>
    <div>
    <p class="keyhelp">
        <span class="key">r</span>
        <span class="key">m</span>
        <span class="key">x</span>
        <span class="key">p</span> &nbsp; toggle line displays
    </p>
    <p class="keyhelp">
        <span class="key">j</span>
        <span class="key">k</span> &nbsp; next/prev highlighted chunk
    </p>
    <p class="keyhelp">
        <span class="key">0</span> &nbsp; (zero) top of page
    </p>
    <p class="keyhelp">
        <span class="key">1</span> &nbsp; (one) first highlighted chunk
    </p>
    </div>
</div>
<div id="source">
    <p id="t1" class="run"><span class="n"><a href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">base64</span><span class="op">,</span> <span class="nam">string</span><span class="op">,</span> <span class="nam">random</span><span class="op">,</span> <span class="nam">requests</span><span class="op">,</span> <span class="nam">sys</span><span class="op">,</span> <span class="nam">secrets</span>&nbsp;</span><span class="r"></span></p>
    <p id="t2" class="run"><span class="n"><a href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span> <span class="key">import</span> <span class="nam">settings</span>&nbsp;</span><span class="r"></span></p>
    <p id="t3" class="run"><span class="n"><a href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">flask</span> <span class="key">import</span> <span class="nam">abort</span>&nbsp;</span><span class="r"></span></p>
    <p id="t4" class="run"><span class="n"><a href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span> <span class="key">import</span> <span class="nam">db</span>&nbsp;</span><span class="r"></span></p>
    <p id="t5" class="run"><span class="n"><a href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">sqlalchemy</span> <span class="key">import</span> <span class="nam">asc</span><span class="op">,</span> <span class="nam">desc</span>&nbsp;</span><span class="r"></span></p>
    <p id="t6" class="run"><span class="n"><a href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">groupmembers</span> <span class="key">import</span> <span class="nam">GroupMember</span>&nbsp;</span><span class="r"></span></p>
    <p id="t7" class="run"><span class="n"><a href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">project_sprints</span> <span class="key">import</span> <span class="nam">ProjectSprint</span>&nbsp;</span><span class="r"></span></p>
    <p id="t8" class="run"><span class="n"><a href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">projects</span> <span class="key">import</span> <span class="nam">Project</span>&nbsp;</span><span class="r"></span></p>
    <p id="t9" class="run"><span class="n"><a href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">users</span> <span class="key">import</span> <span class="nam">User</span>&nbsp;</span><span class="r"></span></p>
    <p id="t10" class="run"><span class="n"><a href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">checklists_results</span> <span class="key">import</span> <span class="nam">ChecklistResult</span>&nbsp;</span><span class="r"></span></p>
    <p id="t11" class="run"><span class="n"><a href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">checklists_kb</span> <span class="key">import</span> <span class="nam">ChecklistKB</span>&nbsp;</span><span class="r"></span></p>
    <p id="t12" class="run"><span class="n"><a href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">checklist_types</span> <span class="key">import</span> <span class="nam">ChecklistType</span>&nbsp;</span><span class="r"></span></p>
    <p id="t13" class="run"><span class="n"><a href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">database</span><span class="op">.</span><span class="nam">kb_items</span> <span class="key">import</span> <span class="nam">KBItem</span>&nbsp;</span><span class="r"></span></p>
    <p id="t14" class="run"><span class="n"><a href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">skf</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">security</span> <span class="key">import</span> <span class="nam">log</span>&nbsp;</span><span class="r"></span></p>
    <p id="t15" class="pln"><span class="n"><a href="#t15">15</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t16" class="pln"><span class="n"><a href="#t16">16</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t17" class="run"><span class="n"><a href="#t17">17</a></span><span class="t"><span class="key">def</span> <span class="nam">get_sprint_item</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t18" class="run"><span class="n"><a href="#t18">18</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User requested specific sprint item"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t19" class="run"><span class="n"><a href="#t19">19</a></span><span class="t">    <span class="nam">result</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t20" class="run"><span class="n"><a href="#t20">20</a></span><span class="t">    <span class="key">return</span> <span class="nam">result</span>&nbsp;</span><span class="r"></span></p>
    <p id="t21" class="pln"><span class="n"><a href="#t21">21</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t22" class="pln"><span class="n"><a href="#t22">22</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t23" class="run"><span class="n"><a href="#t23">23</a></span><span class="t"><span class="key">def</span> <span class="nam">get_sprint_results</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t24" class="run"><span class="n"><a href="#t24">24</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User requested specific sprint items"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t25" class="run"><span class="n"><a href="#t25">25</a></span><span class="t">    <span class="nam">result</span> <span class="op">=</span> <span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">sprint_id</span> <span class="op">==</span> <span class="nam">sprint_id</span><span class="op">)</span><span class="op">.</span><span class="nam">order_by</span><span class="op">(</span><span class="nam">asc</span><span class="op">(</span><span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">checklist_id</span><span class="op">)</span><span class="op">)</span><span class="op">.</span><span class="nam">paginate</span><span class="op">(</span><span class="num">1</span><span class="op">,</span> <span class="num">2500</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t26" class="run"><span class="n"><a href="#t26">26</a></span><span class="t">    <span class="key">return</span> <span class="nam">result</span>&nbsp;</span><span class="r"></span></p>
    <p id="t27" class="pln"><span class="n"><a href="#t27">27</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t28" class="pln"><span class="n"><a href="#t28">28</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t29" class="run"><span class="n"><a href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">update_sprint</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">,</span> <span class="nam">data</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t30" class="run"><span class="n"><a href="#t30">30</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User updated sprint"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t31" class="run"><span class="n"><a href="#t31">31</a></span><span class="t">    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t32" class="run"><span class="n"><a href="#t32">32</a></span><span class="t">        <span class="nam">sprint</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t33" class="run"><span class="n"><a href="#t33">33</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'name'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t34" class="run"><span class="n"><a href="#t34">34</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">description</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'description'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t35" class="run"><span class="n"><a href="#t35">35</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">sprint</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t36" class="run"><span class="n"><a href="#t36">36</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">commit</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t37" class="mis show_mis"><span class="n"><a href="#t37">37</a></span><span class="t">    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t38" class="mis show_mis"><span class="n"><a href="#t38">38</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">rollback</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t39" class="mis show_mis"><span class="n"><a href="#t39">39</a></span><span class="t">        <span class="key">return</span> <span class="nam">abort</span><span class="op">(</span><span class="num">400</span><span class="op">,</span> <span class="str">'Sprint not successfully updated'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t40" class="run"><span class="n"><a href="#t40">40</a></span><span class="t">    <span class="key">return</span> <span class="op">{</span><span class="str">'message'</span><span class="op">:</span> <span class="str">'Sprint successfully updated'</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t41" class="pln"><span class="n"><a href="#t41">41</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t42" class="pln"><span class="n"><a href="#t42">42</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t43" class="run"><span class="n"><a href="#t43">43</a></span><span class="t"><span class="key">def</span> <span class="nam">new_sprint</span><span class="op">(</span><span class="nam">data</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t44" class="run"><span class="n"><a href="#t44">44</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User created new sprint"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t45" class="run"><span class="n"><a href="#t45">45</a></span><span class="t">    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t46" class="run"><span class="n"><a href="#t46">46</a></span><span class="t">        <span class="nam">sprint</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">(</span><span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'name'</span><span class="op">)</span><span class="op">,</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'description'</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t47" class="run"><span class="n"><a href="#t47">47</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">group_id</span> <span class="op">=</span> <span class="num">1</span>&nbsp;</span><span class="r"></span></p>
    <p id="t48" class="run"><span class="n"><a href="#t48">48</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">project_id</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'project_id'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t49" class="run"><span class="n"><a href="#t49">49</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">checklist_type_id</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">'checklist_type_id'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t50" class="run"><span class="n"><a href="#t50">50</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">sprint</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t51" class="run"><span class="n"><a href="#t51">51</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">commit</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t52" class="mis show_mis"><span class="n"><a href="#t52">52</a></span><span class="t">    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t53" class="mis show_mis"><span class="n"><a href="#t53">53</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">rollback</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t54" class="mis show_mis"><span class="n"><a href="#t54">54</a></span><span class="t">        <span class="key">return</span> <span class="nam">abort</span><span class="op">(</span><span class="num">400</span><span class="op">,</span> <span class="str">'Sprint not successfully created'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t55" class="run"><span class="n"><a href="#t55">55</a></span><span class="t">    <span class="nam">result</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">order_by</span><span class="op">(</span><span class="nam">desc</span><span class="op">(</span><span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">sprint_id</span><span class="op">)</span><span class="op">)</span><span class="op">.</span><span class="nam">first</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t56" class="run"><span class="n"><a href="#t56">56</a></span><span class="t">    <span class="key">return</span> <span class="op">{</span><span class="str">'sprint_id'</span><span class="op">:</span> <span class="nam">result</span><span class="op">.</span><span class="nam">sprint_id</span><span class="op">,</span> <span class="str">'message'</span><span class="op">:</span> <span class="str">'Sprint successfully created'</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t57" class="pln"><span class="n"><a href="#t57">57</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t58" class="pln"><span class="n"><a href="#t58">58</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t59" class="run"><span class="n"><a href="#t59">59</a></span><span class="t"><span class="key">def</span> <span class="nam">stats_sprint</span><span class="op">(</span><span class="nam">project_id</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t60" class="run"><span class="n"><a href="#t60">60</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User requested specific project sprint stats"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t61" class="run"><span class="n"><a href="#t61">61</a></span><span class="t">    <span class="nam">sprint_info</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">project_id</span> <span class="op">==</span> <span class="nam">project_id</span><span class="op">)</span><span class="op">.</span><span class="nam">all</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t62" class="run"><span class="n"><a href="#t62">62</a></span><span class="t">    <span class="nam">sprint</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span>&nbsp;</span><span class="r"></span></p>
    <p id="t63" class="run"><span class="n"><a href="#t63">63</a></span><span class="t">    <span class="key">for</span> <span class="nam">result</span> <span class="key">in</span> <span class="nam">sprint_info</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t64" class="run"><span class="n"><a href="#t64">64</a></span><span class="t">        <span class="nam">sprint_id</span> <span class="op">=</span> <span class="nam">result</span><span class="op">.</span><span class="nam">sprint_id</span>&nbsp;</span><span class="r"></span></p>
    <p id="t65" class="run"><span class="n"><a href="#t65">65</a></span><span class="t">        <span class="nam">sprint_desc</span> <span class="op">=</span> <span class="nam">result</span><span class="op">.</span><span class="nam">description</span>&nbsp;</span><span class="r"></span></p>
    <p id="t66" class="run"><span class="n"><a href="#t66">66</a></span><span class="t">        <span class="nam">sprint_name</span> <span class="op">=</span> <span class="nam">result</span><span class="op">.</span><span class="nam">name</span>&nbsp;</span><span class="r"></span></p>
    <p id="t67" class="run"><span class="n"><a href="#t67">67</a></span><span class="t">        <span class="nam">total</span> <span class="op">=</span> <span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">sprint_id</span> <span class="op">==</span> <span class="nam">sprint_id</span><span class="op">)</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t68" class="run"><span class="n"><a href="#t68">68</a></span><span class="t">        <span class="nam">sprint</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">{</span><span class="str">'sprint_id'</span><span class="op">:</span> <span class="nam">sprint_id</span><span class="op">,</span> <span class="str">'sprint_desc'</span><span class="op">:</span> <span class="nam">sprint_desc</span><span class="op">,</span> <span class="str">'title'</span><span class="op">:</span> <span class="nam">sprint_name</span><span class="op">,</span> <span class="str">'sprint_items_total'</span><span class="op">:</span> <span class="nam">total</span> <span class="op">}</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t69" class="run"><span class="n"><a href="#t69">69</a></span><span class="t">    <span class="key">return</span> <span class="nam">sprint</span>&nbsp;</span><span class="r"></span></p>
    <p id="t70" class="pln"><span class="n"><a href="#t70">70</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t71" class="pln"><span class="n"><a href="#t71">71</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t72" class="run"><span class="n"><a href="#t72">72</a></span><span class="t"><span class="key">def</span> <span class="nam">delete_sprint</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t73" class="run"><span class="n"><a href="#t73">73</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User deleted sprint"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t74" class="run"><span class="n"><a href="#t74">74</a></span><span class="t">    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t75" class="run"><span class="n"><a href="#t75">75</a></span><span class="t">        <span class="nam">result</span> <span class="op">=</span> <span class="nam">ProjectSprint</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">sprint_id</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t76" class="run"><span class="n"><a href="#t76">76</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">delete</span><span class="op">(</span><span class="nam">result</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t77" class="run"><span class="n"><a href="#t77">77</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">commit</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t78" class="mis show_mis"><span class="n"><a href="#t78">78</a></span><span class="t">    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t79" class="mis show_mis"><span class="n"><a href="#t79">79</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">rollback</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t80" class="mis show_mis"><span class="n"><a href="#t80">80</a></span><span class="t">        <span class="key">return</span> <span class="nam">abort</span><span class="op">(</span><span class="num">400</span><span class="op">,</span> <span class="str">'Sprint not successfully deleted'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t81" class="run"><span class="n"><a href="#t81">81</a></span><span class="t">    <span class="key">return</span> <span class="op">{</span><span class="str">'message'</span><span class="op">:</span> <span class="str">'Sprint successfully deleted'</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t82" class="pln"><span class="n"><a href="#t82">82</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t83" class="pln"><span class="n"><a href="#t83">83</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t84" class="run"><span class="n"><a href="#t84">84</a></span><span class="t"><span class="key">def</span> <span class="nam">delete_checklist_result</span><span class="op">(</span><span class="nam">id</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t85" class="mis show_mis"><span class="n"><a href="#t85">85</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User deleted sprint"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t86" class="mis show_mis"><span class="n"><a href="#t86">86</a></span><span class="t">    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t87" class="mis show_mis"><span class="n"><a href="#t87">87</a></span><span class="t">        <span class="nam">result</span> <span class="op">=</span> <span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">id</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t88" class="mis show_mis"><span class="n"><a href="#t88">88</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">delete</span><span class="op">(</span><span class="nam">result</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t89" class="mis show_mis"><span class="n"><a href="#t89">89</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">commit</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t90" class="mis show_mis"><span class="n"><a href="#t90">90</a></span><span class="t">    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t91" class="mis show_mis"><span class="n"><a href="#t91">91</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">rollback</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t92" class="mis show_mis"><span class="n"><a href="#t92">92</a></span><span class="t">        <span class="key">return</span> <span class="nam">abort</span><span class="op">(</span><span class="num">400</span><span class="op">,</span> <span class="str">'checklist result successfully deleted'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t93" class="mis show_mis"><span class="n"><a href="#t93">93</a></span><span class="t">    <span class="key">return</span> <span class="op">{</span><span class="str">'message'</span><span class="op">:</span> <span class="str">'checklist result successfully deleted'</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t94" class="pln"><span class="n"><a href="#t94">94</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t95" class="pln"><span class="n"><a href="#t95">95</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t96" class="run"><span class="n"><a href="#t96">96</a></span><span class="t"><span class="key">def</span> <span class="nam">update_checklist_result</span><span class="op">(</span><span class="nam">id</span><span class="op">,</span> <span class="nam">data</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t97" class="mis show_mis"><span class="n"><a href="#t97">97</a></span><span class="t">    <span class="nam">log</span><span class="op">(</span><span class="str">"User deleted sprint"</span><span class="op">,</span> <span class="str">"MEDIUM"</span><span class="op">,</span> <span class="str">"PASS"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t98" class="mis show_mis"><span class="n"><a href="#t98">98</a></span><span class="t">    <span class="nam">resolved</span> <span class="op">=</span> <span class="nam">convert_boolean_type</span><span class="op">(</span><span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"resolved"</span><span class="op">)</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t99" class="mis show_mis"><span class="n"><a href="#t99">99</a></span><span class="t">    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t100" class="mis show_mis"><span class="n"><a href="#t100">100</a></span><span class="t">        <span class="nam">result</span> <span class="op">=</span> <span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">id</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t101" class="mis show_mis"><span class="n"><a href="#t101">101</a></span><span class="t">        <span class="nam">result</span><span class="op">.</span><span class="nam">evidence</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"evidence"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t102" class="mis show_mis"><span class="n"><a href="#t102">102</a></span><span class="t">        <span class="nam">result</span><span class="op">.</span><span class="nam">resolved</span> <span class="op">=</span> <span class="nam">resolved</span>&nbsp;</span><span class="r"></span></p>
    <p id="t103" class="mis show_mis"><span class="n"><a href="#t103">103</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">result</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t104" class="mis show_mis"><span class="n"><a href="#t104">104</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">commit</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t105" class="mis show_mis"><span class="n"><a href="#t105">105</a></span><span class="t">    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t106" class="mis show_mis"><span class="n"><a href="#t106">106</a></span><span class="t">        <span class="nam">db</span><span class="op">.</span><span class="nam">session</span><span class="op">.</span><span class="nam">rollback</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t107" class="mis show_mis"><span class="n"><a href="#t107">107</a></span><span class="t">        <span class="key">return</span> <span class="nam">abort</span><span class="op">(</span><span class="num">400</span><span class="op">,</span> <span class="str">'checklist result not successfully updated'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t108" class="mis show_mis"><span class="n"><a href="#t108">108</a></span><span class="t">    <span class="key">return</span> <span class="op">{</span><span class="str">'message'</span><span class="op">:</span> <span class="str">'checklist result successfully updated'</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
    <p id="t109" class="pln"><span class="n"><a href="#t109">109</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t110" class="pln"><span class="n"><a href="#t110">110</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t111" class="run"><span class="n"><a href="#t111">111</a></span><span class="t"><span class="key">def</span> <span class="nam">convert_boolean_type</span><span class="op">(</span><span class="nam">refine</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t112" class="mis show_mis"><span class="n"><a href="#t112">112</a></span><span class="t">    <span class="key">if</span> <span class="nam">refine</span> <span class="op">==</span> <span class="str">"True"</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t113" class="mis show_mis"><span class="n"><a href="#t113">113</a></span><span class="t">        <span class="nam">refine</span> <span class="op">=</span> <span class="key">True</span>&nbsp;</span><span class="r"></span></p>
    <p id="t114" class="pln"><span class="n"><a href="#t114">114</a></span><span class="t">    <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t115" class="mis show_mis"><span class="n"><a href="#t115">115</a></span><span class="t">        <span class="nam">refine</span> <span class="op">=</span> <span class="key">False</span>&nbsp;</span><span class="r"></span></p>
    <p id="t116" class="mis show_mis"><span class="n"><a href="#t116">116</a></span><span class="t">    <span class="key">return</span> <span class="nam">refine</span>&nbsp;</span><span class="r"></span></p>
    <p id="t117" class="pln"><span class="n"><a href="#t117">117</a></span><span class="t">&nbsp;</span><span class="r"></span></p>
    <p id="t118" class="run"><span class="n"><a href="#t118">118</a></span><span class="t"><span class="key">def</span> <span class="nam">export_results</span><span class="op">(</span><span class="nam">sprint_results</span><span class="op">)</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t119" class="run"><span class="n"><a href="#t119">119</a></span><span class="t">    <span class="nam">results</span> <span class="op">=</span> <span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">sprint_id</span> <span class="op">==</span> <span class="nam">sprint_results</span><span class="op">)</span><span class="op">.</span><span class="nam">order_by</span><span class="op">(</span><span class="nam">ChecklistResult</span><span class="op">.</span><span class="nam">checklist_type_id</span><span class="op">)</span><span class="op">.</span><span class="nam">all</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t120" class="run"><span class="n"><a href="#t120">120</a></span><span class="t">    <span class="nam">unique</span> <span class="op">=</span> <span class="nam">secrets</span><span class="op">.</span><span class="nam">token_urlsafe</span><span class="op">(</span><span class="num">15</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t121" class="run"><span class="n"><a href="#t121">121</a></span><span class="t">    <span class="nam">file_path</span> <span class="op">=</span> <span class="str">"export_"</span><span class="op">+</span><span class="nam">unique</span><span class="op">+</span><span class="str">".csv"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t122" class="run"><span class="n"><a href="#t122">122</a></span><span class="t">    <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">file_path</span><span class="op">,</span> <span class="str">'w+'</span><span class="op">)</span> <span class="key">as</span> <span class="nam">file</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t123" class="run"><span class="n"><a href="#t123">123</a></span><span class="t">        <span class="nam">file</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">'title,description,mitigation\n'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t124" class="run"><span class="n"><a href="#t124">124</a></span><span class="t">        <span class="key">for</span> <span class="nam">item</span> <span class="key">in</span> <span class="nam">results</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t125" class="mis show_mis"><span class="n"><a href="#t125">125</a></span><span class="t">            <span class="key">if</span> <span class="nam">item</span><span class="op">.</span><span class="nam">kb_id</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t126" class="mis show_mis"><span class="n"><a href="#t126">126</a></span><span class="t">                <span class="key">if</span> <span class="nam">item</span><span class="op">.</span><span class="nam">checklist_type_id</span> <span class="op">!=</span> <span class="key">None</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t127" class="mis show_mis"><span class="n"><a href="#t127">127</a></span><span class="t">                    <span class="nam">name</span> <span class="op">=</span> <span class="nam">ChecklistType</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ChecklistType</span><span class="op">.</span><span class="nam">id</span> <span class="op">==</span> <span class="nam">item</span><span class="op">.</span><span class="nam">checklist_type_id</span><span class="op">)</span><span class="op">.</span><span class="nam">first</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t128" class="mis show_mis"><span class="n"><a href="#t128">128</a></span><span class="t">                    <span class="nam">checklistName</span> <span class="op">=</span> <span class="nam">name</span><span class="op">.</span><span class="nam">name</span>&nbsp;</span><span class="r"></span></p>
    <p id="t129" class="pln"><span class="n"><a href="#t129">129</a></span><span class="t">                <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t130" class="mis show_mis"><span class="n"><a href="#t130">130</a></span><span class="t">                    <span class="nam">checklistName</span> <span class="op">=</span> <span class="str">"Removed"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t131" class="mis show_mis"><span class="n"><a href="#t131">131</a></span><span class="t">                <span class="nam">checklist</span> <span class="op">=</span> <span class="nam">ChecklistKB</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">ChecklistKB</span><span class="op">.</span><span class="nam">id</span> <span class="op">==</span> <span class="nam">item</span><span class="op">.</span><span class="nam">checklist_id</span><span class="op">)</span><span class="op">.</span><span class="nam">first</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t132" class="mis show_mis"><span class="n"><a href="#t132">132</a></span><span class="t">                <span class="nam">kb_item</span> <span class="op">=</span> <span class="nam">KBItem</span><span class="op">.</span><span class="nam">query</span><span class="op">.</span><span class="nam">filter</span><span class="op">(</span><span class="nam">KBItem</span><span class="op">.</span><span class="nam">kb_id</span> <span class="op">==</span> <span class="nam">item</span><span class="op">.</span><span class="nam">kb_id</span><span class="op">)</span><span class="op">.</span><span class="nam">first</span><span class="op">(</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t133" class="mis show_mis"><span class="n"><a href="#t133">133</a></span><span class="t">                <span class="nam">title</span> <span class="op">=</span> <span class="nam">checklist</span><span class="op">.</span><span class="nam">content</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">','</span><span class="op">,</span><span class="str">'\\,'</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'\n'</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'  '</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t134" class="mis show_mis"><span class="n"><a href="#t134">134</a></span><span class="t">                <span class="key">if</span> <span class="nam">kb_item</span> <span class="op">!=</span> <span class="key">None</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t135" class="mis show_mis"><span class="n"><a href="#t135">135</a></span><span class="t">                    <span class="key">try</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t136" class="mis show_mis"><span class="n"><a href="#t136">136</a></span><span class="t">                        <span class="nam">temp</span> <span class="op">=</span> <span class="nam">kb_item</span><span class="op">.</span><span class="nam">content</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">','</span><span class="op">,</span><span class="str">'\\,'</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"Mitigation:"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t137" class="mis show_mis"><span class="n"><a href="#t137">137</a></span><span class="t">                        <span class="nam">temp1</span> <span class="op">=</span> <span class="nam">temp</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"Description:"</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t138" class="mis show_mis"><span class="n"><a href="#t138">138</a></span><span class="t">                        <span class="nam">description</span> <span class="op">=</span> <span class="nam">temp1</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'\n'</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'  '</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t139" class="mis show_mis"><span class="n"><a href="#t139">139</a></span><span class="t">                        <span class="nam">mitigation</span> <span class="op">=</span> <span class="nam">temp</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'\n'</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">' '</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">'  '</span><span class="op">,</span><span class="str">' '</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t140" class="mis show_mis"><span class="n"><a href="#t140">140</a></span><span class="t">                    <span class="key">except</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t141" class="mis show_mis"><span class="n"><a href="#t141">141</a></span><span class="t">                        <span class="nam">description</span> <span class="op">=</span> <span class="str">"empty"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t142" class="mis show_mis"><span class="n"><a href="#t142">142</a></span><span class="t">                        <span class="nam">mitigation</span> <span class="op">=</span> <span class="str">"empty"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t143" class="pln"><span class="n"><a href="#t143">143</a></span><span class="t">                <span class="key">else</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t144" class="mis show_mis"><span class="n"><a href="#t144">144</a></span><span class="t">                    <span class="nam">description</span> <span class="op">=</span> <span class="str">"empty"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t145" class="mis show_mis"><span class="n"><a href="#t145">145</a></span><span class="t">                    <span class="nam">mitigation</span> <span class="op">=</span> <span class="str">"empty"</span>&nbsp;</span><span class="r"></span></p>
    <p id="t146" class="mis show_mis"><span class="n"><a href="#t146">146</a></span><span class="t">                <span class="nam">file</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">'"'</span> <span class="op">+</span> <span class="nam">checklistName</span> <span class="op">+</span> <span class="str">' : '</span> <span class="op">+</span> <span class="nam">title</span> <span class="op">+</span> <span class="str">'","'</span> <span class="op">+</span> <span class="nam">description</span> <span class="op">+</span> <span class="str">'","'</span> <span class="op">+</span> <span class="nam">mitigation</span> <span class="op">+</span> <span class="str">'"\n'</span><span class="op">)</span>&nbsp;</span><span class="r"></span></p>
    <p id="t147" class="run"><span class="n"><a href="#t147">147</a></span><span class="t">    <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="str">"export_"</span><span class="op">+</span><span class="nam">unique</span><span class="op">+</span><span class="str">".csv"</span><span class="op">,</span> <span class="str">'rb'</span><span class="op">)</span> <span class="key">as</span> <span class="nam">file</span><span class="op">:</span>&nbsp;</span><span class="r"></span></p>
    <p id="t148" class="run"><span class="n"><a href="#t148">148</a></span><span class="t">        <span class="key">return</span> <span class="op">{</span><span class="str">'message'</span><span class="op">:</span> <span class="nam">base64</span><span class="op">.</span><span class="nam">b64encode</span><span class="op">(</span><span class="nam">file</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">}</span>&nbsp;</span><span class="r"></span></p>
</div>
<div id="footer">
    <div class="content">
        <p>
            <a class="nav" href="index.html">&#xab; index</a> &nbsp; &nbsp; <a class="nav" href="https://coverage.readthedocs.io">coverage.py v5.5</a>,
            created at 2021-03-26 13:45 +0100
        </p>
    </div>
</div>
</body>
</html>
